package elements
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Shape;
	import starling.display.Image;
	import starling.display.Sprite;
	import starling.events.Event;
	import starling.display.Shape;
	import starling.events.TouchEvent;

	
	public class MonSprite extends Sprite
	{
		// mon sprite poura avoir plusieurs formes, on poura le déplacer sur la scene etc...
		
		public function MonSprite()
		{
			super();
			addEventListener(Event.ADDED_TO_STAGE, added);
		}
		
		private function added(evt:Event):void
		{
			//enlever le listener
			removeEventListener(Event.ADDED_TO_STAGE, added);
			
			
			//dessiner
			drawContent();
		}
		
		public function drawContent():void
		{
			
			
			var _forme:starling.display.Shape = new starling.display.Shape();
			
			_forme.graphics.beginFill(0x0000FF, 1);
			_forme.graphics.drawEllipse(0, 0, 100, 100);
			_forme.graphics.endFill();
			
			this.addChild(_forme);
			
			_forme.addEventListener(TouchEvent.TOUCH, deplacement);
			
			
		}
		
		public function deplacement(e:TouchEvent):void
		{
			if (e.getTouch(this, TouchPhase.BEGAN))
			{
				//trace(evt.getTouch(this).globalX);
				//trace(evt.getTouch(this).globalY);
				trace("coucou mon sprite");
			}
		}
		
	}
}